package com.ddf.jose.scheduled;

import com.ddf.publics.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * @program: dingding-financial
 * @description: 111
 * @author: jose
 * @create: 2020-06-16 16:57
 **/
@Component
public class JoseScheduled {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;


    @Autowired
    private RedisUtil redisUtil;

    @Scheduled(cron="0 0 0 1 * ?") //每月执行一次
    public void sign_on(){
        Set<String> keys = redisTemplate.keys("sign:*");
        keys.forEach((String key)->{
            redisUtil.del(key);
        });
    }
}
